Type.registerNamespace('Ajax.Logging');

Ajax.Logging.PanelListener = function(lineSeparator, targetElement)
{
    if (typeof targetElement == 'string')
    {
        this._element = $get(targetElement);
    }
    else
    {
        this._element = targetElement;
    }

    Ajax.Logging.PanelListener.initializeBase(this, [lineSeparator]);
}

Ajax.Logging.PanelListener.prototype =
{
    dispose : function()
    {
        this._element = null;
        Ajax.Logging.PanelListener.callBaseMethod(this, 'dispose');
    },

    publishException : function(errorCode, exception, environmentInfo)
    {
        var errorInfo = Ajax.Logging.PanelListener.callBaseMethod(this, 'formatException', [errorCode, exception]);
        var lineSeparator = Ajax.Logging.PanelListener.callBaseMethod(this, 'get_lineSeparator')

        if (this._element.innerHTML.length > 0)
        {
            //Put some extra breaks
            this._element.innerHTML = lineSeparator + lineSeparator + this._element.innerHTML;
        }

        this._element.innerHTML = errorInfo + this._element.innerHTML;
    }
}

Ajax.Logging.PanelListener.registerClass('Ajax.Logging.PanelListener', Ajax.Logging.BaseListener);

if (typeof(Sys) != 'undefined')
{
    Sys.Application.notifyScriptLoaded();
}